//
//  Messaging.h
//  iCan - iPhone Context-Aware Navigation
//  Carnegie Mellon University - 18-842 Distributed Systems
//
//  Created by Andrew Santell on 3/26/12.
//  Copyright (c) 2012 Andrew Santell. All rights reserved.

#import <UIKit/UIKit.h>
#import "iCanAppDelegate.h"
#import "SpinnerView.h"
#import "MsgDetails.h"

@interface Messaging : UIViewController <UITextFieldDelegate, NSStreamDelegate, UITextViewDelegate>
{
    iCanAppDelegate *appDelegate;
    NSString *result;
    NSString *message;
    NSInputStream *inputStream;
    NSOutputStream *outputStream;
    MsgDetails *details;
    BOOL badCookie;
}


@property (weak, nonatomic) IBOutlet UITextField *recipients;
@property (weak, nonatomic) IBOutlet UITextView *messageData;
@property (retain, nonatomic) iCanAppDelegate *appDelegate;
@property (retain, nonatomic) NSInputStream *inputStream;
@property (retain, nonatomic) NSOutputStream *outputStream;
@property (retain, nonatomic) SpinnerView *spinner;
@property (retain, nonatomic) NSString *result;
@property (retain, nonatomic) NSString *message;
@property (retain, nonatomic) MsgDetails *details;
@property BOOL badCookie;

- (IBAction)sendMessage:(id)sender;
- (void) analyzeResult;
- (void) initNetworkCommunication;
- (void) stream:(NSStream *)theStream handleEvent:(NSStreamEvent)streamEvent;


@end
